<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/admin/commons/taglib.jsp"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台管理</title>
    <script type="text/javascript">
        var type = ${order.status}
        $(function(){
            $("#order").addClass("active");
            $("#order").find("ul li").eq(type).addClass("active");
        })
    </script>
</head>
<body>

    <div class="admin">

        <div class="panel admin-panel">
            <div class="panel-head">
                <form method="post" action="order!orderList.action">
                    <div class="line-middle">
                        <div class="x3">

                        </div>
                        <div class="x5 ">
                            <input name="order.orderNumber" type="text" class="input radius-rounded"
                                   placeholder="请输入订单编号" value="${order.orderNumber}"/>
                        </div>
                        <div class="x4">
                            <button type="submit" class="button bg-blue">
                                搜索
                            </button>
                        </div>
                    </div>
                </form>
                <strong>用户列表</strong>
            </div>
            <form id="form" method="post" action="order!delete.action">
                <div class="padding border-bottom">
                    <input type="button" id="selectall" class="button button-small checkall"  checkfor="id" value="全选" />
                    <input type="button" onClick="submit()" class="button button-small border-yellow" value="批量删除" />
                    <input type="button" class="button button-small border-yellow" value="导出订单" />
                </div>

                <table class="table table-hover">
                    <tr>
                        <th width="100">
                            选择
                        </th>
                        <th width="150">
                            购买人
                        </th>
                        <th width="250">
                            订单号
                        </th>
                        <th width="250">
                            订单类型
                        </th>
                        <th width="250">
                            下单时间
                        </th>
                        <th width="150">
                            付款方式
                        </th>
                        <th width="150">
                            状态
                        </th>
                        <th width="150">
                            订单金额
                        </th>
                        <th width="200">
                            操作
                        </th>
                    </tr>
                   <s:iterator value="pageBean.data">
                    <tr>
                        <td><input type="checkbox" class="choose" name="id" value="<s:property value="orderId"/>" /></td>
                        <td><s:property value="team.name"/></td>
                        <td><s:property value="orderNumber"/></td>
                        <td><s:property value="type==1?'家教订单':'培训班订单'"/></td>
                        <td><s:property value="orderTime"/></td>
                        <td><s:property value="paymethod"/></td>
                        <td style="color: red"><s:property value="status==1?'待付款':'已付款'"/></td>
                        <td><s:property value="price"/></td>

                        <td><a class="button border-blue button-little" href="order!toDetail.action?order.id=<s:property value="id"/>" >查看</a>
                            <a class="button border-red button-little" href="order!delete.action?order.id=<s:property value="id"/>"
                               onclick="{if (confirm('确认删除?')) {return true;}return false;};">删除</a></td>
                    </tr>
                    </s:iterator>
                </table>
            </form>
        </div>

        <div>
            <s:include value="/admin/commons/page.jsp"></s:include>
        </div>
    </div>

    <script type="text/javascript">
        function submit(){
            var choose= document.getElementsByClassName("choose");
            if($('#selectall').is(':checked')) {
                choose[i].checked = true;
            }else{
                choose[i].checked = false;
            }
            document.getElementBy("form").submit();
        }
    </script>
</body>
</html>
